<template>
  <div class="main">
    <h2>附近店铺</h2>
    <router-link v-for="item in mainList" :key="item._id" class="router" :to='{name:"Shop",params: {id:item._id}}'>
    <Nearby-shop :item='item' border='border_b'></Nearby-shop>
    </router-link>
  </div>
</template>

<style lang="scss" scoped>
.main {
  padding: 0 0.18rem 0.49rem 0.18rem;
}
</style>

<script>
import { ajax } from '../../assets/js/public.js'
import { ref } from '@vue/reactivity'
import NearbyShop from '../../components/nearbyShop/nearbyShop.vue'
const mainList = ref([])
export default {
  name: 'Main',
  components: {
    NearbyShop
  },
  setup () {
    ajax({
      url: 'https://www.fastmock.site/mock/725f551276b487c75861c5507f612adb/jingdong/api/home',
      type: 'get',
      list: mainList
    })
    return { mainList }
  }
}
</script>
